import com.demo.Controller.StudentController;
import com.demo.Controller.UserAdviceController;
import com.demo.Controller.UserController;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class APP {
    public static void main(String[] args) {
        //1.得到spring对象
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        //2.从spring取出Bean对象
        //UserController userController = (UserController) context.getBean("userController");
//        Student student = context.getBean("s2",Student.class);
//        System.out.println(student.toString());
//        StudentController studentController = context.getBean("studentController",StudentController.class);
//        studentController.saiHi();
        UserController userController = context.getBean("userController",UserController.class);
        UserAdviceController userAdviceController = context.getBean("userAdviceController",UserAdviceController.class);
        userController.saiHi();
        userAdviceController.getUser();
    }
}
